
export function dateFormat(attr) {
  var t = new Date(attr)
  const year = t.getFullYear()
  const month = checkTime(t.getMonth() + 1)
  const date = checkTime(t.getDate())
  const hours = checkTime(t.getHours())
  const minutes = checkTime(t.getMinutes())
  const second = checkTime(t.getSeconds())
  return year + '-' + month + '-' + date + ' ' + hours + ':' + minutes + ':' + second
}

function checkTime(i) {
  if (i < 10) {
    i = '0' + i
  }
  return i
}
